import java.awt.*;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yang
 * Date: 2022-05-29
 * Time: 20:05
 */

public class Main {

//    public static void func() throws UsernameException,PasswordException{
//        StringBuilder str = null;
//        try{
//            throw new UsernameException("用户名异常！");
//        }catch (UsernameException e){
//            System.out.println("捕获到了异常！");
//        }
//    }
    public static void main(String[] args)throws UsernameException,PasswordException{
        User user = new User("abc","123");
        Scanner scan = new Scanner(System.in);
        System.out.println("输入用户名：");
        String username = scan.nextLine();
        System.out.println("输入密码：");
        String password = scan.nextLine();


        try {
            user.login(username,password);
        }catch (UsernameException e){
            e.printStackTrace();
        }catch (PasswordException e){
            e.printStackTrace();
        }
    }
}

